/**
 * 通知
 */
import { DeleteRequestApi, GetRequestApi, PostRequestApi, PutRequestApi } from '@/utils/api/RequestApi'
import { Notice } from '@/entity/system/notice'
import { BaseParam, BaseType } from '@/components/base/form-item/props'
import { PageModel } from '@/entity/base-model'

export const NOTICE_API_PRE_SUFFER = '/sysNotice/'

export default {
  /**
   * 新增
   * @param data 数据
   */
  add: (data: BaseParam) => new PostRequestApi<Notice>(NOTICE_API_PRE_SUFFER, data).get(),
  /**
   * 修改
   * @param data 数据
   */
  update: (data: BaseParam) => new PutRequestApi<Notice>(NOTICE_API_PRE_SUFFER, data).get(),
  /**
   * 分页
   * @param data 数据
   */
  page: (data: BaseParam) => new PostRequestApi<PageModel<Notice>>(NOTICE_API_PRE_SUFFER + '/page', data).get(),
  /**
   * 查询
   * @param data 数据
   */
  get: (data: string) => new GetRequestApi<Notice>(NOTICE_API_PRE_SUFFER + data).get(),
  /**
   * 删除
   * @param data 数据
   */
  delete: (data: string) => new DeleteRequestApi<boolean>(NOTICE_API_PRE_SUFFER + data).get(),
  /**
   * 发布
   * @param data 数据
   */
  publish: (data: string) => new PutRequestApi<boolean>(NOTICE_API_PRE_SUFFER + 'publish/' + data).get(),
  /**
   * 禁用
   * @param data 数据
   */
  disabled: (data: string) => new PutRequestApi<boolean>(NOTICE_API_PRE_SUFFER + 'disable/' + data).get(),
}
